using System;
using System.IO;

namespace SuiHan.Commons.Daemon.Util {
    public static class ContextUtils {
        /// <summary>
        /// 获取当前上下文路径
        /// </summary>
        /// <returns></returns>
        public static string GetContextPath() {
            return AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
        }

        /// <summary>
        /// 获取基于启动程序路径的资源绝对路径
        /// </summary>
        /// <param name="name">资源名称</param>
        /// <returns></returns>
        public static string GetContextResourcePath(string name) {
            return Path.Combine(GetContextPath(), name);
        }
    }
}
